Skip to main content

User Identification in Events

How to Cross-Reference Information to Identify the User

In many operational scenarios, identifying the user responsible for an event is essential for analysis, contextual actions, and auditing. Below, we list possible approaches to perform this identification based on secure technical practices compatible with privacy guidelines.

1 - Using notificationToken:

This function expects a String parameter, which represents the user's notification token. On iOS, this token is provided by APNS (Apple Push Notification Service), while on Android, it is obtained through Firebase Cloud Messaging.

Android

Requirements

  • Must have a Firebase project with FCM enabled
  • React-native-firebase (documentation)
  • Minimum Compiled SDK of 31

Firebase only:

On the App.js or App.tsx file of the React-native project, call the following method:

//Import grouplink sdk
import * as GroupLinkSDK from '@grouplinknetwork/rn-grouplink-sdk';

export default function App() {
React.useEffect(() => {
//set firebase token
GroupLinkSDK.setFirebaseToken(token);
...
}, []);
return (
<View style={styles.container}>
<Text>This is a test application</Text>
</View>
);
}

OneSignal only:

//Import grouplink sdk
import * as GroupLinkSDK from 'rn-grouplink-sdk';
import * as OneSignal from 'onesignal-node';

export default function App() {
React.useEffect(() => {
//initialize Grouplink and OneSignal
...
setPushToken();
}, []);
return (
<View style={styles.container}>
<Text>This is a test application</Text>
</View>
);
}

async function setPushToken() {
let deviceState: OneSignal.DeviceState|null = (await OneSignal.default.getDeviceState());
if(deviceState!=null){
let token : String = deviceState.pushToken;
console.log("PUSH TOKEN => " + token);
GroupLinkSDK.setFirebaseToken(token);
}
}

2 - Using notification_name:

This function expects a String parameter that represents the notification name associated with the device. This name is a customizable identifier you can use to manage or label notifications for a specific user or context.

We strongly recommend not using sensitive information in the notification_name. Instead, use unique identifiers that are properly encrypted or obfuscated. For example, using the user's session-id is a safer approach that helps ensure security and privacy when identifying devices.

Setting user notification_name:

export default function App() {
useEffect(() => {
...
GroupLinkSDK.setNotificationName(exampleNotificationName);
}, []);

return (
<View style={styles.container}>
<Text>This is a test application</Text>
</View>
);
}

Getting the user notification_name:

export default function App() {
useEffect(() => {
...
let notificationName = GroupLinkSDK.getNotificationName();
}, []);

return (
<View style={styles.container}>
<Text>This is a test application</Text>
</View>
);
}